package com.ddtech.business.train.controller;

import com.ddtech.business.train.entity.TrainRecord;
import com.ddtech.business.train.query.TrainRecordQuery;
import com.ddtech.business.train.service.TrainRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @version v1.0
 * @ClassName:TrainRecordController description：
 * @author:wei_zhang(xiao)
 * @date: 2024-11-24 15:42
 */
@Api(tags = "业务-训练记录")
@RestController
@RequestMapping("/train")
public class TrainRecordController {

    @Autowired
    private TrainRecordService trainRecordService;

    @ApiOperation(value = "保存训练记录")
    @PostMapping(value = "/create")
    public ResponseEntity create(@RequestBody TrainRecord trainRecord) {
        return new ResponseEntity(trainRecordService.create(trainRecord), HttpStatus.OK);
    }

    @ApiOperation(value = "获取训练记录")
    @GetMapping(value = "/getData")
    public ResponseEntity getData(TrainRecordQuery trainRecordQuery) {
        return new ResponseEntity(trainRecordService.getData(trainRecordQuery), HttpStatus.OK);
    }

    @ApiOperation(value = "报表查询")
    @GetMapping(value = "/report")
    public ResponseEntity getReport(TrainRecordQuery trainRecordQuery) {
        return new ResponseEntity(trainRecordService.getReport(trainRecordQuery), HttpStatus.OK);
    }
}
